#region

using System;
using ThuySan.Bussiness;

#endregion

namespace ThuySan.Models
{
    [Serializable]
    public partial class CategoryTagModel
    {
        #region Constructor

        public CategoryTagModel()
        {
        }

        public CategoryTagModel(CategoryTag value)
        {
            Id = value.Id;
            CategoryId = value.CategoryId;
            TagId = value.TagId;
        }

        #endregion

        #region Fields

        private Int32? _CategoryId;

        private Int32 _Id;

        private Int32? _TagId;

        #endregion

        #region Properties

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32 Id
        {
            get { return _Id; }
            set { _Id = value; }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32? CategoryId
        {
            get { return _CategoryId; }
            set { _CategoryId = value; }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32? TagId
        {
            get { return _TagId; }
            set { _TagId = value; }
        }

        #endregion

        #region Operators

        public void Update(CategoryTag value)
        {
            value.Id = Id;
            value.CategoryId = CategoryId;
            value.TagId = TagId;
        }

        public static implicit operator CategoryTagModel(CategoryTag obj)
        {
            return new CategoryTagModel(obj);
        }

        public static implicit operator CategoryTag(CategoryTagModel obj)
        {
            CategoryTag value = new CategoryTag();
            obj.Update(value);
            return value;
        }

        #endregion
    }
}
